#ifndef SHADER_H
#define SHADER_H

#include <glad/glad.h>

#include <string>

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "log.h"

class Shader
{
public:
    unsigned int ID;
    Shader(const char *vertexPath, const char *fragmentPath);
    Shader();
    ~Shader();
    inline void use()
    {
        glUseProgram(ID);
    }
    // utility uniform functions
    // ------------------------------------------------------------------------
    void setUniformValue(const std::string &name, bool value) const;
    void setUniformValue(const std::string &name, int value) const;
    void setUniformValue(const std::string &name, float value) const;
    void setUniformValue(const std::string &name, float *value) const;
    void setUniformValue(const std::string &name, glm::mat4 &value) const;

private:
    // utility function for checking shader compilation/linking errors.
    // ------------------------------------------------------------------------
    void checkCompileErrors(unsigned int shader, std::string type);

    void buildShader(const char *vertex, const char *fragment);
};
#endif
